| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

TreeView.h
1 // TreeView.h
3 //
5
6 namespace nkWinUi
7 {
11 class TreeView : public Component
12 {
13 public :
14
18 class Item
19 {
20 public :
21
25 Item () noexcept ;
29 virtual ~Item () ;
30
37 Item* addChild (Item* child) ;
42 Item* getChild (unsigned int index) const ;
46 unsigned int getChildCount () const ;
50 bool isParent () const ;
56 void disavowChild (Item* child) ;
57
63 void setText (nkMemory::StringView text) ;
69 void setIcon (Image* image) ;
73 nkMemory::StringView getText () const ;
77 Image* getIcon () const ;
78
84 void setParentTree (TreeView* parent) ;
88 TreeView* getParentTree () const ;
94 void setParentItem (Item* item) ;
98 Item* getParentItem () const ;
99
107 void setAttachedData (void* data) ;
111 void* getAttachedData () const ;
112
113 // Flags
117 bool getCollapsed () const ;
124 virtual void setCollapsed (bool value) ;
125
131 void exportIntrospection (nkExport::Node* rootNode) ;
132 } ;
133
134 public :
135
143 TreeView (System* system) noexcept ;
147 virtual ~TreeView () ;
148
149 // Getters
154 Item* getItemFromData (void* data) const ;
158 virtual Item* getSelectedItem () = 0 ;
163 virtual Item* getItemAtAbsoluteCursor (nkMaths::Point absCoords) = 0 ;
168 virtual Item* getItemAtRelativeCursor (nkMaths::Point relCoords) = 0 ;
172 bool getSelectOnRightClick () const ;
176 std::function<void (TreeView*)> getSelectionCallback () const ;
177
178 // Setters
184 void setSelectionOnRightClick (bool value) ;
192 void setSelectionCallback (std::function<void (TreeView*)> value) ;
193
203 virtual Item* insertItem (nkMemory::StringView text, void* data, Item* parent = nullptr) ;
210 virtual void deleteItem (Item* toDelete, bool keepChildrenOnUpper = false) ;
217 virtual void changeItemLabel (Item* toChange, nkMemory::StringView label) ;
221 virtual void clearItems () ;
227 void collapseAll (bool status) ;
228
234 void selectItemFromItsData (void* data) ;
240 virtual void selectItem (Item* item) = 0 ;
246 void selectItemFromAbsoluteCursor (nkMaths::Point absCoords) ;
252 void selectItemFromRelativeCursor (nkMaths::Point relCoords) ;
253
254 // Import / Export
255 virtual void exportIntrospection (nkExport::Node* rootNode) override ;
256 virtual void importClassFromTree (nkExport::Node* rootNode) override ;
257
258 public :
259
260 // Statics
268 static nkMemory::UniquePtr<TreeView> create (System* system = nullptr) ;
269 } ;
270 }
nkWinUi::TreeView::Item::isParent
bool isParent() const
nkWinUi::TreeView::Item::getParentItem
Item * getParentItem() const
nkWinUi::TreeView::Item::getChildCount
unsigned int getChildCount() const
nkWinUi::Image
Abstracts an image to be used within the component.
Definition: Image.h:12
nkWinUi::TreeView::Item::setParentItem
void setParentItem(Item *item)
nkWinUi::TreeView::Item::setIcon
void setIcon(Image *image)
nkWinUi::TreeView::Item::getIcon
Image * getIcon() const
nkWinUi::TreeView::Item::getCollapsed
bool getCollapsed() const
nkWinUi::TreeView::Item::getAttachedData
void * getAttachedData() const
nkWinUi::TreeView::Item::setAttachedData
void setAttachedData(void *data)
nkWinUi::TreeView::getSelectOnRightClick
bool getSelectOnRightClick() const
nkWinUi::TreeView
A graphical tree view window.
Definition: TreeView.h:12
nkWinUi::TreeView::getSelectedItem
virtual Item * getSelectedItem()=0
nkWinUi::TreeView::setSelectionCallback
void setSelectionCallback(std::function< void(TreeView *)> value)
nkMaths
Encompasses all API of component NilkinsMaths.
Definition: IntVector.h:7
nkWinUi::TreeView::Item
Holds information of a tree view item.
Definition: TreeView.h:19
nkWinUi::TreeView::create
static nkMemory::UniquePtr< TreeView > create(System *system=nullptr)
nkWinUi::TreeView::selectItemFromRelativeCursor
void selectItemFromRelativeCursor(nkMaths::Point relCoords)
nkWinUi::TreeView::selectItemFromAbsoluteCursor
void selectItemFromAbsoluteCursor(nkMaths::Point absCoords)
nkWinUi::TreeView::Item::setCollapsed
virtual void setCollapsed(bool value)
nkWinUi::TreeView::insertItem
virtual Item * insertItem(nkMemory::StringView text, void *data, Item *parent=nullptr)
nkExport
Encompasses all API of component NilkinsExport.
Definition: Base64Encoder.h:7
nkWinUi::TreeView::Item::addChild
Item * addChild(Item *child)
nkWinUi::TreeView::Item::getParentTree
TreeView * getParentTree() const
nkWinUi::Component
Base class for any graphical component.
Definition: Component.h:12
nkWinUi::TreeView::getItemAtAbsoluteCursor
virtual Item * getItemAtAbsoluteCursor(nkMaths::Point absCoords)=0
nkWinUi::System
The main system of the component.
Definition: System.h:18
nkWinUi::TreeView::importClassFromTree
virtual void importClassFromTree(nkExport::Node *rootNode) override
nkWinUi::TreeView::clearItems
virtual void clearItems()
nkWinUi::TreeView::getItemAtRelativeCursor
virtual Item * getItemAtRelativeCursor(nkMaths::Point relCoords)=0
nkWinUi::TreeView::getSelectionCallback
std::function< void(TreeView *)> getSelectionCallback() const
nkWinUi::TreeView::selectItem
virtual void selectItem(Item *item)=0
nkWinUi::TreeView::deleteItem
virtual void deleteItem(Item *toDelete, bool keepChildrenOnUpper=false)
nkWinUi::TreeView::Item::setText
void setText(nkMemory::StringView text)
nkWinUi::TreeView::Item::Item
Item() noexcept
nkWinUi::TreeView::Item::disavowChild
void disavowChild(Item *child)
nkWinUi::TreeView::selectItemFromItsData
void selectItemFromItsData(void *data)
nkWinUi::TreeView::Item::getText
nkMemory::StringView getText() const
nkWinUi::TreeView::changeItemLabel
virtual void changeItemLabel(Item *toChange, nkMemory::StringView label)
nkWinUi::TreeView::Item::setParentTree
void setParentTree(TreeView *parent)
nkWinUi
Encompasses all API of component NilkinsWinUi.
Definition: Clipboard.h:7
nkWinUi::TreeView::collapseAll
void collapseAll(bool status)
nkWinUi::TreeView::getItemFromData
Item * getItemFromData(void *data) const
nkWinUi::TreeView::Item::exportIntrospection
void exportIntrospection(nkExport::Node *rootNode)
nkWinUi::TreeView::setSelectionOnRightClick
void setSelectionOnRightClick(bool value)
nkWinUi::TreeView::Item::getChild
Item * getChild(unsigned int index) const
nkMemory
Encompasses all API of component NilkinsMemory.
Definition: Allocator.h:7